function reducer (state, action) {
  switch(action.type) {
    case 'setFacility': 
      return {...state, ...action.payload}
    default: 
      throw new Error();
  }
}

function initReducer (init) {
  let obj = {
    facility: null,
    history: false
  }
  return Object.assign(obj, init)
}

export {
  reducer,
  initReducer
} 